import QtQuick 2.6

import "../../Base/UiBase"
import "../../Base/Config"

Item {
    id: root

    signal commentPageClicked
    property bool upActivated: false
    property int upNumber: 0

    width: parent.width
    height: 50 * Size.ratio

    MouseArea {
        id: favoriteButton
        property bool activated: false
        onClicked: activated = !activated

        height: parent.height
        width: parent.width / 3
        anchors.left: parent.left

        SvgzImage {
            height: 50 * Size.ratio
            width: 118 * Size.ratio
            anchors.centerIn: parent
            source: favoriteButton.activated ? "../../../resources/tcommunity/posts/shoucang02.svg" : "../../../resources/tcommunity/posts/shoucang01.svg"
        }
        RightDivider {
            height: parent.height * 0.75
            anchors.verticalCenter: parent.verticalCenter
        }
    }

    MouseArea {
        id: commentPageButton
        property bool activated: false

        onClicked: {
            commentPageClicked()
            activated = !activated
        }

        height: parent.height
        width: parent.width / 3
        anchors.horizontalCenter: parent.horizontalCenter
        SvgzImage {
            id: submitCommentButton

            height: 50 * Size.ratio
            width: 118 * Size.ratio
            anchors.centerIn: parent

            source: commentPageButton.activated ? "../../../resources/tcommunity/posts/pinglun02.svg" : "../../../resources/tcommunity/posts/pinglun01.svg"
        }
        RightDivider {
            height: parent.height * 0.75
            anchors.verticalCenter: parent.verticalCenter
        }
    }

    MouseArea {
        onClicked: upNumber = (root.upActivated = !root.upActivated)

        height: parent.height
        width: parent.width / 3
        anchors.right: parent.right

        SvgzImage {
            id: upButton

            height: 50 * Size.ratio
            width: 118 * Size.ratio
            anchors.centerIn: parent

            source: root.upActivated ? "../../../resources/tcommunity/posts/zan02.svg" : "../../../resources/tcommunity/posts/zan01.svg"

            Text {
                id: upNumberLabel

                anchors {
                    verticalCenter: parent.verticalCenter
                    left: parent.right
                    leftMargin: -47 * Size.ratio
                }

                font.pixelSize: Size.smallFont

                text: String(root.upNumber)
            }
        }
    }
}
